# -*- coding: utf-8 -*-
# @Time : 2019/1/17 15:54
# @Author : Administrator
# @File : stu_manage.py
# @Project : code
# @title : 学员管理-考勤、阶段测评
import unittest,time
# from boss_GUI.common.stu_mana import StuManage
import warnings,os

from boss_GUI.common.stu_mana import StuManage
from selenium.webdriver.support import select


class StuMan(unittest.TestCase):
    @classmethod
    def setUpClass(cls):
        warnings.simplefilter("ignore", ResourceWarning)  #不显示该报错信息
        cls.s =  StuManage()

    def test_clo001(self):   #今日考勤，对单个学生考勤操作为请假，考勤结果显示为请假
        a = '请假'
        ac = self.s.clocking_in(a)
        self.assertEqual(ac,a)

    def test_clo002(self):   #今日考勤，对单个学生考勤操作为面试，考勤结果显示为面试
        a = '面试'
        ac = self.s.clocking_in(a)
        self.assertEqual(ac,a)

    def test_clo003(self):   #今日考勤，对单个学生考勤操作为迟到，考勤结果显示为迟到
        a = '迟到'
        ac = self.s.clocking_in(a)
        self.assertEqual(ac,a)

    def test_clo004(self):   #今日考勤，对单个学生考勤操作为旷课，考勤结果显示为旷课
        a = '旷课'
        ac = self.s.clocking_in(a)
        self.assertEqual(ac,a)

    def test_clo005(self):  # 今日考勤，对单个学生考勤操作为正常，考勤结果显示为正常
        a = '正常'
        ac = self.s.clocking_in(a)
        self.assertEqual(ac, a)

    def test_clo_query006(self):  #姓名输入学生姓名，列表展示该学生的信息
        # 取第一行的学生姓名，进行查询
        name,result = self.s.clo_query()
        self.assertEqual(name,result)

    def test_b_clo007(self):    #批量考勤，对单个学生考勤操作为正常，该学生考勤结果显示为正常
        a = '正常'
        ac = self.s.batch_clo(a)
        # assert a==ac
        self.assertEqual(a, ac)
    def test_b_clo008(self):   #批量考勤，对单个学生考勤操作为迟到，该学生考勤结果显示为迟到
        a = '迟到'
        ac = self.s.batch_clo(a)
        # assert a == ac
        self.assertEqual(a, ac)

    def test_b_clo009(self):   #批量考勤，对单个学生考勤操作为旷课，该学生考勤结果显示为旷课
        a = '旷课'
        ac = self.s.batch_clo(a)
        # assert a == ac
        self.assertEqual(a, ac)

    def test_b_clo010(self):   #批量考勤，对单个学生考勤操作为请假，该学生考勤结果显示为请假
        a = '请假'
        ac = self.s.batch_clo(a)
        # assert a == ac
        self.assertEqual(a, ac)

    def test_b_clo011(self):   #批量考勤，对单个学生考勤操作为面试，该学生考勤结果显示为面试
        a = '面试'
        ac = self.s.batch_clo(a)
        # assert a == ac
        self.assertEqual(a, ac)

    def test_ass_query012(self):   #查询当前列表第一行的姓名，显示该学生信息
        name,ac = self.s.ass_query()
        self.assertEqual(name,ac)

    def test_ass_exe013(self):   #对第一行的学生进行测评
        sec = "专业第一阶段"
        score = "84"
        content = "学习力强"
        self.s.ass_exe(sec, score, content)
    #
    def test_ass_down014(self):    #对第一行的学生进行降级操作,方向输入测试，班级输入WNCDC001
        dir = '测试'
        cla = 'WNCDC001'
        cla_ac, dir_ac = self.s.ass_down(dir,cla)
        self.assertEqual(dir,dir_ac)
        self.assertEqual(cla,cla_ac)

    def test_ass_down015(self):    #对第一行的学生进行降级操作，方向输入开发，班级输入WNCDC002
        dir = '开发'
        cla = 'WNCDC002'
        cla_ac, dir_ac = self.s.ass_down(dir,cla)
        self.assertEqual(dir,dir_ac)
        self.assertEqual(cla,cla_ac)

    def test_ass_down016(self):    #对第一行的学生进行降级操作,方向输入测试，班级输入WNCDC034
        dir = '测试'
        cla = 'WNCDC034'
        cla_ac, dir_ac = self.s.ass_down(dir,cla)
        self.assertEqual(dir,dir_ac)
        self.assertEqual(cla,cla_ac)

    def test_ass_down017(self):    #对第一行的学生进行降级操作，方向输入开发，班级输入WNCDC034
        dir = '开发'
        cla = 'WNCDC034'
        cla_ac, dir_ac = self.s.ass_down(dir,cla)
        self.assertEqual(dir,dir_ac)
        self.assertEqual(cla,cla_ac)

    @classmethod
    def tearDownClass(cls):
        os.system("taskkill /F /IM chrome.exe")

if __name__ == '__main__':
    unittest.main()